package com.ruoyi.controller;

import com.ruoyi.dto.ResponseDTO;
import com.ruoyi.pojo.MessageList;
import com.ruoyi.pojo.Store;
import com.ruoyi.povo.MessageListVo;
import com.ruoyi.povo.MessageVo;
import com.ruoyi.service.StoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
public class StoreController {
    @Autowired
    private StoreService storeService;
    @RequestMapping("/getStoreById")
    public ResponseDTO getStoreById(@RequestParam String id) {

        return storeService.getStoreById(id);
    }
    @RequestMapping("/preserveStore")
    public ResponseDTO preserveStore(@RequestBody Store store) {

        System.out.println(store);
        return storeService.preserveStore(store);
    }
    @RequestMapping("/changeStore")
    public ResponseDTO changeStore(@RequestParam String id,@RequestParam String status) {


        return storeService.changeStore(id,status);
    }
    @RequestMapping("/getUserById")
    public ResponseDTO getUserById(@RequestParam String id) {
        return storeService.getUserById(id);
    }




    @RequestMapping("/storeMessageList")
    public ResponseDTO storeMessageList(@RequestBody MessageListVo messageListVo) {
        System.out.println(messageListVo);
       return storeService.storeMessageList(messageListVo);
    }
    @RequestMapping("/getMessageList")
    public ResponseDTO getMessageList(@RequestParam String id) {

        return storeService.getMessageList(id);
    }
    @RequestMapping("/readMessageList")
    public ResponseDTO readMessageList(String id) {

        return storeService.readMessageList(id);
    }
    @RequestMapping("/storeMessage")
    public ResponseDTO storeMessage(@RequestBody MessageVo messageVo) {

        return storeService.storeMessage(messageVo);
    }
    @RequestMapping("/getMessageById")
    public ResponseDTO getMessageById(@RequestParam String fromUid,@RequestParam String toUid) {

        return storeService.getMessageById(fromUid,toUid);
    }
    @RequestMapping("/getMessageByFromId")
    public ResponseDTO getMessageByFromId(@RequestParam String id) {

        return storeService.getMessageByFromId(id);
    }
    @RequestMapping("/readAllMessage")
    public ResponseDTO readAllMessageC(@RequestParam String fromUid,@RequestParam String toUid) {

        return storeService.readAllMessage(fromUid,toUid);
    }
    @RequestMapping("/readAllMessageS")
    public ResponseDTO readAllMessageS(@RequestParam String id) {

        return storeService.readAllMessageS(id);
    }




}
